﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using DTO;
using DataService;

public partial class Admin_AccountDetails : System.Web.UI.Page
{
    private AdminService service = new AdminService();
    protected void Page_Load(object sender, EventArgs e)
    {
        gvListUsers.AutoGenerateColumns = false;
        if (Session[AdminService.ADMIN_SESSION] == null)
        {
            Response.Redirect("~/admin/login.aspx");
        }
        else
        {
            ShowData();   
        }
    }

    public void ShowData()
    {
        if (!string.IsNullOrEmpty(Convert.ToString( Request.QueryString["AccountId"])))
        {
            IList<User> users = service.GetListUsersByAccountId(Convert.ToInt32(Request.QueryString["AccountId"]));
            if (users.Count > 0)
            {
                gvListUsers.DataSource = users;
                gvListUsers.DataBind();
            }
        }
    }
}